package com.beauty.dressing.common.bean;

import com.framework.common.utils.IJsonUtil;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * 搜索关键字的历史记录
 * @author lying
 * @company 9zhitx.com
 */
public class SearchHistory extends BaseBean implements Serializable {

    /** 自增长ID */
    public long id;
    /** 搜索关键字 */
    public String keyword;
    /** 搜索类型0表示资讯，1表示视频， 2 表示明星 */
    public int type;
    /** 搜索时间 */
    public long time;

    public SearchHistory(){}

    public SearchHistory(String keyword, int type, long time) {
        this.keyword = keyword;
        this.type = type;
        this.time = time;
    }
    
    public SearchHistory(long id, String keyword, int type, long time) {
		this.id = id;
		this.keyword = keyword;
        this.type = type;
		this.time = time;
	}

    public void parse(JSONObject json) {
        if (json == null) {
            return;
        }

        keyword = IJsonUtil.getString("keyword", json);
        time = IJsonUtil.getLong("time", json);
    }

    @Override
    public String toString() {
        return "SearchHistory{" +
                "keyword='" + keyword + '\'' +
                ", time=" + time +
                '}';
    }
}
